<?php
/*========================================= JooSam =========================================/
/																							/
/	Extention:		JooSam																	/
/	Created by:		ScriptPlanet.eu															/
/	Site:			http://www.scriptplanet.eu												/
/	Email:			support@scriptplanet.eu													/
/	Support:		http://www.scriptplanet.eu/support										/
/	Copyright:		2011 (c) ScriptPlanet.eu												/
/	License:		CC BY-NC-ND 3.0 ~ http://creativecommons.org/licenses/by-nc-nd/3.0/		/
/	File Version:	0001																	/
/																							/
/========================================== JooSam ========================================*/
// Joomla Security
defined('_JEXEC') or die;

// Joomla import
jimport('joomla.application.component.controller');


// JooSam main controller
class JoosamController extends JController{
	
	// JooSam Main display function
	public function display($cachable = false, $urlparams = false){
		
		// Add submenu
		JoosamHelper::addSubmenu(JRequest::getCmd('view', 'joosam'));
		$view	= JRequest::getCmd('view', 'joosam');
		$layout = JRequest::getCmd('layout', 'default');
		$id		= JRequest::getInt('id');

		// Security check (not tested yet
		if ($view == 'esettings' && $layout == 'edit' && !$this->checkEditId('com_joosam.edit.setting', $id)) {
			// Somehow the person just went to the form - we don't allow that.
			$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
			$this->setMessage($this->getError(), 'error');
			$this->setRedirect(JRoute::_('index.php?option=com_joosam&view=settings', false));
			return false;
		}
		parent::display();
		return $this;
	}
}